package com.xmall.product.define.request.spu;

import com.xmall.validate.group.AddGroup;
import com.xmall.validate.group.UpdateGroup;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.List;

/**
 * 返回数据格式：product - spu_sale_attr
 */
@Data
public class SpuSaleAttrRequest implements Serializable {

    /**
     * spuID
     */
    private Long spuId;

    /**
     * 名称
     */
    @NotBlank(message = "名称不能为空", groups = { AddGroup.class, UpdateGroup.class })
    @Size(min = 2, max = 20, message = "名称长度必须在 2 到 20 之间", groups = { AddGroup.class, UpdateGroup.class })
    private String name;

    /**
     * 排序
     */
    @NotNull(message = "排序不能为空", groups = { AddGroup.class, UpdateGroup.class })
    private Integer sort;

    /**
     * 销售属性值
     */
    @Valid
    private List<SpuSaleAttrOptionRequest> optionList;
}
